import request from '../utils/request.js'

export function createOrder(order) {
	return request('order/create',{
		orderGoodsId:order.orderGoodsId,
		orderUserId:order.orderUserId,
		orderOpenId:order.orderOpenId,
		orderBatchId:order.orderBatchId,
		orderGroupId:order.orderGroupId,
		orderOutletsId:order.orderOutletsId,
		orderConsignee:order.orderConsignee,
		orderTel:order.orderTel,
		orderBuyCount:order.orderBuyCount,
		orderTotalFee:order.orderTotalFee,
		orderScore:order.orderScore
	})
}

export function getOrderByOrderId(id) {
	return request('order/select/'+id)
}

export function getOrderShortInfoById(id) {
	return request('/order/select/m/'+id)
}

export function getOrderByStatus(status) {
	let app = getApp()
	return request('order/select/m/'+ app.globalData.user.userOpenid +'/'+ status)
}

export function updateOrderStatusToSuccess(id) {
	return request('/order/status/'+id+'/1')
}

export function updateOrderStatusToCancle(id) {
	return request('/order/status/'+id+'/-1')
}

export function confirmOrder(id) {
	return request('/order/confirm/'+id)
}